﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="PayFines.ascx.cs" Inherits="PayFines" %>

<h2>Pay Fines</h2>

<asp:Label ID="lblSearch" runat="server" Text="Search for Patron by: Name or Phone: "></asp:Label>
<asp:TextBox ID="txtSearch" runat="server"></asp:TextBox>
<asp:Button ID="btnSearch" runat="server" Text="Search" 
    onclick="btnSearch_Click" />

<br />

<asp:Label ID="lblMessageTop" runat="server" Text="" ForeColor="Red"></asp:Label>
<br />
<br />
<asp:GridView ID="GridView_Person" runat="server" AutoGenerateColumns="False" 
    DataKeyNames="PersonID" onselectedindexchanged="GridView1_SelectedIndexChanged">
    <Columns>
        <asp:BoundField DataField="PersonID" HeaderText="Card Number" />
        <asp:TemplateField HeaderText="Name">
            <EditItemTemplate>
                <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("FirstName") %>'></asp:TextBox>
                <asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("LastName") %>'></asp:TextBox>
            </EditItemTemplate>
            <ItemTemplate>
                <asp:Label ID="Label1" runat="server" Text='<%# Bind("FirstName") %>'></asp:Label>
                <asp:Label ID="Label2" runat="server" Text='<%# Bind("LastName") %>'></asp:Label>
            </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="Phone">
            <EditItemTemplate>
                <asp:TextBox ID="TextBox3" runat="server" Text='<%# Bind("PhoneNumber") %>'></asp:TextBox>
            </EditItemTemplate>
            <ItemTemplate>
                <asp:Label ID="Label3" runat="server" 
                    Text='<%# Convert.ToInt64(Eval("PhoneNumber").ToString().Replace(" ",
                    "").Replace(".", "").Replace("-", "").Replace("(", "").Replace(")",
                    "")).ToString("000-000-0000") %>'></asp:Label>
            </ItemTemplate>
        </asp:TemplateField>
        <asp:BoundField DataField="Address" HeaderText="Address" />
        <asp:BoundField DataField="Fines" DataFormatString="{0:c}" HeaderText="Fines">
            <ItemStyle ForeColor="Red" />
        </asp:BoundField>
        <asp:CommandField ShowSelectButton="True" />
    </Columns>
</asp:GridView>
    <br />
    <br />
<asp:Panel ID="panelPay" runat="server" Visible="false">
    <asp:Label ID="lblAmount" runat="server" Text="Amount Paid: "></asp:Label>
    <asp:TextBox ID="txtAmount" runat="server"></asp:TextBox>
    <asp:Button ID="btnAmount" runat="server" Text="Apply to Fines" onclick="btnAmount_Click" />
    <asp:Label ID="lblMessage" runat="server" Text="" ForeColor="Red"></asp:Label>
</asp:Panel>

